package com.zmj.sy.mom.srv.aps.controller;

import com.zmj.sy.mom.srv.aps.bean.vo.base.BaseResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.partpallet.PartPalletListReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.partpallet.PartPalletListResVo;
import com.zmj.sy.mom.srv.aps.bean.vo.partpallet.PartPalletAllMoveReqVo;
import com.zmj.sy.mom.srv.aps.bean.vo.partpallet.PartPalletReqVo;
import com.zmj.sy.mom.srv.aps.service.PartPalletService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequiredArgsConstructor
@Api(tags = "零件位置信息")
@RestController
@RequestMapping("/partPallet")
public class PartPalletController {

    private final PartPalletService partPalletService;

    @GetMapping("/list")
    public List<PartPalletListResVo> list(PartPalletListReqVo reqVo){
        return partPalletService.list(reqVo);
    }

    @ApiOperation("托盘零件清到工位")
    @PostMapping("/allMove")
    public BaseResVo allMove(@RequestBody PartPalletAllMoveReqVo reqVo){
        partPalletService.move(reqVo);
        return BaseResVo.ok();
    }
    @ApiOperation("维护在制品的唯一号")
    @PostMapping("/updateUniqueCode")
    public BaseResVo updateUniqueCode(@Validated @RequestBody PartPalletReqVo reqVo){
        partPalletService.updateUniqueCode(reqVo);
        return BaseResVo.ok();
    }
}
